from rest_framework.serializers import ModelSerializer
from paths.models import *
from user.models import User


class StageModelSerializer(ModelSerializer):
    class Meta:
        model = Stage
        depth = 1
        # fields = '__all__'
        exclude = ['path', 'c_time', 'u_time']


class PathsModelSerializer(ModelSerializer):
    stage_set = StageModelSerializer(many=True)

    class Meta:
        model = Paths
        # fields = '__all__'
        fields = ['id', 'title', 'desc', 'img', 'count_course', 'count_length', 'stage_set']


class UserModelSerializer(ModelSerializer):
    class Meta:
        model = User
        fields = ['id', 'nick_name', 'img']


class ToPathCommentModelSerializer(ModelSerializer):
    user = UserModelSerializer()

    class Meta:
        model = PathComment
        depth = 1
        # fields = '__all__'
        exclude = ['path']


class PathCommentModelSerializer(ModelSerializer):
    user = UserModelSerializer()
    to = ToPathCommentModelSerializer()

    class Meta:
        model = PathComment
        depth = 1
        # fields = '__all__'
        exclude = ['path']
